/*
 * @ProjectName: 编程学习
 * @Copyright:   2019 HangZhou Yi Dev, Ltd. All Right Reserved.
 * @address:     https://yiyuery.github.io/
 * @date:        2019/12/8 5:53 下午
 * @email:       xiazhaoyang@live.com
 * @description: 本内容仅限于编程技术学习使用，转发请注明出处.
 */
package com.example.spring.event.source;

import com.example.spring.event.common.EventSourceTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.ApplicationContextEvent;

/**
 * <p>
 *  抽象事件源定义
 * </p>
 *
 * @author Yi
 * @version V1.0.0
 * @date 2019/12/8 5:53 下午
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人}  2019/12/8
 * @modify reason: {方法名}:{原因}
 * ...
 */
@Getter
@Setter
public abstract class AbstractMessageEvent extends ApplicationContextEvent {

    private String message;

    private EventSourceTypeEnum sourceType = EventSourceTypeEnum.EVENT_SOURCE_TYPE_ENUM_BUSINESS_1;

    public abstract String getEventSource();

    /**
     * Create a new ContextStartedEvent.
     *
     * @param source the {@code ApplicationContext} that the event is raised for
     *               (must not be {@code null})
     */
    public AbstractMessageEvent(ApplicationContext source) {
        super(source);
    }

    public AbstractMessageEvent(ApplicationContext source, String message) {
        super(source);
        setMessage(message);
    }
}
